def get_scripts(name):
    if name == "detail_zhihu":
        script = """
        function main(splash, args)
          --splash.resource_timeout = 0
          --splash:set_custom_headers(splash.args.headers)
          --splash:init_cookies(splash.args.cookies)
          assert(splash:go(args.url))
          local i = 0
          local y = 'ppp'
          local max_loop_nums = 1000
          while 1 do
            i = i+1
            splash:runjs('document.getElementById("QuestionAnswers-answers").scrollIntoView(false)')
            splash:runjs('document.getElementById("QuestionAnswers-answers").scrollIntoView()')
            splash:runjs('document.getElementById("QuestionAnswers-answers").scrollIntoView(false)')
            assert(splash:wait(0.1))
            local f = splash:jsfunc([[
              function(){
              var x = document.getElementsByClassName("Button QuestionAnswers-answerButton Button--blue Button--spread")
              return x.length
              }
            ]])
            x = f()
                if x > 0 then
              y = x
              break
            end
            if i > max_loop_nums then
              break
            end
          end
          return {
            html = splash:html(),
            num = i,
            y=y,
          }
        end
        """
        return script

    if name == "index_zhihu":
        script = """
        function main(splash, args)
            --splash.resource_timeout = 0

        
            splash:init_cookies(splash.args.cookies)
            --splash:set_custom_headers(splash.args.headers)
            assert(splash:go(args.url))
            
            local i = 0
            local max_loop_nums = 100
            while 1 do
                i = i+1
                splash:runjs('document.getElementById("QuestionAnswers-answers").scrollIntoView(false)')
                splash:runjs('document.getElementById("QuestionAnswers-answers").scrollIntoView()')
                splash:runjs('document.getElementById("QuestionAnswers-answers").scrollIntoView(false)')
                assert(splash:wait(1))
                if i > max_loop_nums then
                    break
                end
            end
            return {
                html = splash:html(),
                data = splash:get_cookies()
            }
        end
        """
        return script

    if name == 'test':
        script = """
        function main(splash, args)
          --splash.resource_timeout = 0
          
          splash:init_cookies(splash.args.cookies)
          
          assert(splash:go(args.url))
          
          local i = 0
          
          local max_loop_nums = 4
          
          while 1 do
            i = i+1
            splash:runjs('document.getElementById("root").scrollIntoView(false)')
            splash:runjs('document.getElementById("root").scrollIntoView()')
            splash:runjs('document.getElementById("root").scrollIntoView(false)')
            assert(splash:wait(2))
            if i > max_loop_nums then
              break
            end
          end
          return {
            html = splash:html(),
            cookies = splash:get_cookies(),
          }
        end"""
        return script
